import { http } from '@/utils/http/axios';
import { getMenuListResultModel } from '@/api/system/model/menuModel';
import { GetPermissionListModel } from '@/api/system/model/roleModel';

/**
 * @description: 根据用户id获取用户菜单
 */
export function adminMenus() {
  return http.request(
    {
      url: '/authority/resources/router',
      method: 'GET',
    },
    {
      isTransformResponse: false,
    }
  );
}

/**
 * 获取tree菜单列表
 */
export const getMenuList = () => {
  return http.request<getMenuListResultModel>({ url: '/authority/resources/router' });
};

export const GetPermissionList = (roleId: number) => {
  return http.request<GetPermissionListModel>({
    url: `/authority/roles/${roleId}/resources/permissions`,
    params: { roleId: roleId },
  });
};
